package cc.idoone.spring_boot_hello.jms;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;

import javax.jms.Destination;

/**
 * @auther hemj
 * @since 2017/9/28
 */
@Service("producer")
public class Producer {

	@Autowired
	private JmsMessagingTemplate jmsTemplate;

	public void sendMessage(Destination destination, final String message) {
		jmsTemplate.convertAndSend(destination, message);
	}

	//@JmsListener(destination = "out.queue")
	public void consumerMessage(String message) {
		System.out.println("从 out.queue 队列收到的回复报文为: " + message);
	}
}
